package com.ly.spring;

import com.ly.spring.mapper.UserMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Company 源辰信息
 *
 * @author navy
 * @date 2024/11/2
 * Email haijunzhou@hnit.edu.cn
 */
@Configuration
// 组件扫描, 扫描指定的包及其子包
@ComponentScan("com.ly.spring")
// ComponentScan 除了会扫描到 组件 , 也会扫码到配置类,
// 扫描到配置类也会被执行加载
public class AutowireAnnoConfig {

    @Bean("myUserMapper")
    public UserMapper userMapper(){
        UserMapper userMapper = new UserMapper();
        userMapper.setMyName("李四");
        return userMapper;
    }
}
